/************************************************************
**  File:   hal_lcd12864.h
**  Brief:  Support for Serial Operate LCD12864
**  Date:   2014-7-17 10:32:47
**  Update: add LCD12864 Files to Z-Stack
**  Author: GuoZhenjiang <zhenjiang.guo@sunplusapp.com>
***********************************************************/

#ifndef __HAL_USARTLCD_H__
#define __HAL_USARTLCD_H__
#include "hal_types.h"

#define RGB565(r,g,b)   ((((uint16)(r) & 0xF8) << 8) | (((uint16)(g) & 0xFC) << 3) | (((uint16)(b) & 0xF8) >> 3))
typedef enum {
    TextSize12 = 12, TextSize16 = 16,
    TextSize24 = 24, TextSize32 = 32,
    TextSize48 = 48, TextSize64 = 64
} UsartLcdTextSize;
typedef enum {
    DirectionHorizontal = 0, DirectionVertical,
    DirectionHorizontalVers, DirectionVerticalVers
} UsartLcdDirection;
typedef enum {
    LcdWidth = 220, LcdHeight = 176,
    DefaultTextSize = TextSize16
} UsartLcdParameters;

#if defined(USARTLCD)
extern void UsartLcdInit(void);
extern void UsartLcdClear(uint8 crIndex);
extern void UsartLcdSetColorTable(uint8 crIndex, uint16 cr);
extern void UsartLcdDrawPoint(uint16 x, uint16 y, uint8 crIndex);
extern void UsartLcdDrawLine(uint16 x1, uint16 y1, uint16 x2, uint16 y2, uint8 crIndex);
extern void UsartLcdDrawBox(uint16 x1, uint16 y1, uint16 x2, uint16 y2, uint8 crIndex, bool fill);
extern void UsartLcdDrawPicture(uint16 x, uint16 y, uint16 picIndex);
extern void UsartLcdDrawCircle(uint16 x, uint16 y, uint16 r, uint8 crIndex);
extern void UsartLcdShowPage(uint16 pgIndex);
extern void UsartLcdDisplayText(UsartLcdTextSize size, uint16 x, uint16 y, const char *text, uint8 crIndex);
extern void UsartLcdDisplayTextInBlock(UsartLcdTextSize size, uint16 x, uint16 y, uint16 right, uint16 lineSpace, const char *text, uint8 crIndex);
extern void UsartLcdChargeDirection(UsartLcdDirection dir);
#else
#define UsartLcdInit()  do {} while(0)
#define UsartLcdClear(a) do {} while(0)
#define UsartLcdSetColorTable(a,b) do {} while(0)
#define UsartLcdDrawPoint(x, y, crIndex)  do {} while(0)
#define UsartLcdDrawLine(x1, y1, x2, y2, crIndex)  do {} while(0)
#define UsartLcdDrawBox(x1, y1, x2, y2, crIndex, fill)  do {} while(0)
#define UsartLcdDrawPicture(x, y, picIndex)  do {} while(0)
#define UsartLcdDrawCircle(x, y, r, crIndex)  do {} while(0)
#define UsartLcdShowPage(pgIndex)  do {} while(0)
#define UsartLcdDisplayText(size, x, y, text, crIndex)  do {} while(0)
#define UsartLcdDisplayTextInBlock(size, x,  y, right, lineSpace, text, crIndex)  do {} while(0)
#define UsartLcdChargeDirection(dir)  do {} while(0)

#endif

#endif//#ifndef __HAL_USARTLCD_H__